from selenium import webdriver
from selenium.webdriver.common.by import By
import time

# 1.打开游览器
driver = webdriver.Chrome()
# 2.打开360网址
driver.get('https://www.so.com')
# 3.输入搜索关键字
kw = driver.find_element(By.ID,'input')
kw.send_keys('天气预报')
sr = driver.find_element(By.ID,'search-button')
sr.click()
# 4.获取标题打印
time.sleep(2)
print(driver.title)
# 5.关闭游览器
time.sleep(2)
driver.quit()